# -*- coding:utf-8 -*-
import linuxtemplates

#定义监控主机
web_groups = linuxtemplates.LinuxGenericTemplate()
web_groups.hosts = ['192.168.1.3','192.168.1.4']

mysql_groups = linuxtemplates.Linux2()
mysql_groups.hosts = ['10.0.0.5','10.0.0.6']

monitor_groups = [web_groups,mysql_groups]

if __name__ == "__main__":
    host_config_dic = {}

    for group in monitor_groups:
        #print group,
        for host in group.hosts:
            #print host,   
            #为每台新主机创建一个空字典
            if host not in host_config_dic:
                host_config_dic[host] = {}
            for s in group.services:
                host_config_dic[host][s.name]=[s.plugin_name,s.interval]
    
    print host_config_dic 